Open
Conversation
BREAKING CHANGE: messages.list() now returns PaginatedMessagesResponse
with {data, next_cursor, has_more} instead of list[TaskMessage].
Changes:
- Add cursor and direction params to MessageListParams
- Add PaginatedMessagesResponse type with data, next_cursor, has_more
- Update list() method signature in Messages resource
- Update tests for new response format
Backwards-compatible change: - Original messages.list() unchanged (returns List[TaskMessage]) - New messages.list_paginated() for cursor pagination (returns PaginatedMessagesResponse) - MessageListParams and MessageListPaginatedParams split for clarity
MichaelSun48
pushed a commit
to scaleapi/scale-agentex
that referenced
this pull request
Dec 9, 2025
## Summary
Implements cursor-based pagination for the `/messages` endpoint to
enable infinite scroll in the UI.
### Breaking Change
`GET /messages` now returns `PaginatedMessagesResponse` instead of raw
array:
```json
{ "data": [...], "next_cursor": "...", "has_more": true }
```
### Backend Changes
- Add `cursor` and `direction` query params to `/messages`
- Return `{data, next_cursor, has_more}` response format
- Add `pagination.py` with cursor encode/decode utilities
- Add `find_by_field_with_cursor()` to MongoDB adapter
### Frontend Changes
- Replace `useTaskMessages` with `useInfiniteTaskMessages` hook
- Implement infinite scroll with IntersectionObserver
- Add scroll position preservation when loading older messages
- Fix Thinking indicator timing
- Remove deprecated `custom-subscribe-task-state.tsx`
### Related PRs
- TypeScript SDK: TBD
- Python SDK: scaleapi/scale-agentex-python#222
### Suggested Deployment Order
1. Deploy this PR (backend)
2. Publish TypeScript SDK
3. Publish Python SDK
4. Deploy frontend (after updating SDK version)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds cursor-based pagination support to match backend API changes.
Breaking Change
messages.list()now returnsPaginatedMessagesResponse:Changes
cursoranddirectionparams toMessageListParamsPaginatedMessagesResponsetype withdata,next_cursor,has_morelist()method signature in Messages resourceRelated PRs